<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8" isELIgnored="false"%>
<%@ include file="/WEB-INF/common/head.jsp"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>添加用户</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="text/javascript" src="${resource }/js/jquery-2.1.1.min.js"></script>
<link rel="stylesheet" href="${resource }/css/bootstrap.css" />
<link rel="stylesheet" href="${resource }/css/iconfont.css" />
</head>
<body>
	<div class="row wrapper border-bottom white-bg page-heading">
		<div class="col-sm-4">
			<h2>用户管理</h2>
			<ol class="breadcrumb">
				<li><a href="index.html">主页</a></li>
				<li><strong>添加用户</strong></li>
			</ol>
		</div>
	</div>
	<div class="row wrapper border-bottom white-bg page-heading">
		<div class="col-md-12">
			<!-- 用户列表--bootstrap高级表格使用 -->
			<div class="panel panel-default">
				<div class="panel-heading">添加用户</div>
				<div class="panel-body">
					<form action="add.do"method="post" >
						<div class="form-group">
							<label for="txtAccount">账号</label> <input type="text"
								class="form-control" name="userAccount" placeholder="账号" value=""autocomplete="off">
						</div>
						<div class="form-group">
							<label for="txtMobile">密码</label> <input type="text"
								class="form-control" name="userPwd" placeholder="密码"autocomplete="off">
						</div>
						<div class="form-group">
							<label for="txtUserName">姓名</label> <input type="text"
								class="form-control" name="userName" placeholder="姓名"autocomplete="off">
						</div>
						<div class="form-group">
						    <label for="txtUserRole">角色</label>
							 <select class="form-control" name="roleName" id="role">
								<c:forEach var="name"  items="${rlist}">
							    <option >${name.roleName}</option>
							   </c:forEach>
							</select>
						</div>
						<div class="form-group">
							<label for="txtPhone">电话</label> <input type="text"
								class="form-control" name="userTel" placeholder="电话"autocomplete="off">
						</div>
						<div class="form-group">
							<label for="txtSex">部门</label>  
							<select class="form-control" name="departName" id="depart">
								<c:forEach var="name"  items="${dlist}">
									<option>${name.deptName}</option>
								 </c:forEach>
							</select>
						</div>
						<div class="form-group">
							<label for="txtSex">状态</label>  
							<select class="form-control" name="userState" >
								<option value="1">可用</option>
								<option value="0">停用</option>
							</select>
						</div>
						<button type="submit" class="btn btn-success" id="saveuser">保存</button>
						<button type="reset" class="btn btn-info">重置</button>
					</form>
				</div>
			</div>
		</div>
		<!--表格结束 -->
	</div>
	<script>
$(document).ready(function() {
        var submit="add.do";
		$("form").submit(function(){
			var s=$("#role  option:selected");
		//	alert("123"+s.text().slice(0,3));
			var d=$("#depart option:selected");
			//alert("456"+d.text());
			if(d.text()!=s.text().slice(0,3))
			{  
				alert("部门与角色不匹配");
				return false;	
			}
			
		});
	});
	</script>
</body>
</html>